/*
 Navicat Premium Data Transfer

 Source Server         : local
 Source Server Type    : MySQL
 Source Server Version : 80032 (8.0.32)
 Source Host           : localhost:3306
 Source Schema         : love

 Target Server Type    : MySQL
 Target Server Version : 80032 (8.0.32)
 File Encoding         : 65001

 Date: 22/06/2023 22:21:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_award
-- ----------------------------
DROP TABLE IF EXISTS `tb_award`;
CREATE TABLE `tb_award` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `award` varchar(30) NOT NULL COMMENT '奖品名',
  `price` int NOT NULL COMMENT '兑换分值',
  `status` enum('1','0','2','3') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '兑换状态(‘0’未领取 ‘1’已领取未发奖 ''2''已发奖 ‘3’已使用)',
  `user_id` int NOT NULL COMMENT '用户id',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tb_award
-- ----------------------------
BEGIN;
INSERT INTO `tb_award` (`id`, `award`, `price`, `status`, `user_id`) VALUES (28, '一根热狗', 5, '1', 32);
COMMIT;

-- ----------------------------
-- Table structure for tb_heartbeat
-- ----------------------------
DROP TABLE IF EXISTS `tb_heartbeat`;
CREATE TABLE `tb_heartbeat` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '标题',
  `date` datetime NOT NULL COMMENT '时间',
  `score` int NOT NULL COMMENT '分值',
  `add_min` enum('0','1') NOT NULL COMMENT '加分还是减分(1为加分 0为减分)',
  `total_points` int NOT NULL COMMENT '加减分后的总分',
  `info` text COMMENT '描述详情',
  `user_id` int NOT NULL COMMENT '我的id',
  `love_id` int NOT NULL COMMENT '对方的id',
  `exchange_point` enum('false','true') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'false' COMMENT '是否为奖品兑换点(true 是 false不是)',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `id1` (`user_id`),
  KEY `id2` (`love_id`),
  CONSTRAINT `id1` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`love_id`),
  CONSTRAINT `id2` FOREIGN KEY (`love_id`) REFERENCES `tb_user` (`love_id`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_heartbeat
-- ----------------------------
BEGIN;
INSERT INTO `tb_heartbeat` (`id`, `title`, `date`, `score`, `add_min`, `total_points`, `info`, `user_id`, `love_id`, `exchange_point`) VALUES (77, '看电影', '2023-06-22 08:00:00', 10, '1', 10, '你曾是我的挚爱，就像我身体里的血液捧在手心怕有意外，但好像每次用力过界', 31, 32, 'false');
INSERT INTO `tb_heartbeat` (`id`, `title`, `date`, `score`, `add_min`, `total_points`, `info`, `user_id`, `love_id`, `exchange_point`) VALUES (78, '不给我零花钱', '2023-06-22 08:00:00', 2, '0', 8, '可惜酒我喝得再多都无法让时间倒退，每个酒醒时分都已没有机会去赎罪', 31, 32, 'false');
INSERT INTO `tb_heartbeat` (`id`, `title`, `date`, `score`, `add_min`, `total_points`, `info`, `user_id`, `love_id`, `exchange_point`) VALUES (79, '「兑换奖品」', '2023-06-22 22:15:21', 5, '0', 3, '在这天花费5积分兑换了「一根热狗」 ', 31, 32, 'true');
COMMIT;

-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `password` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `love_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `love_id` (`love_id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tb_user
-- ----------------------------
BEGIN;
INSERT INTO `tb_user` (`id`, `username`, `password`, `name`, `code`, `love_id`) VALUES (31, '但丁', '666666', '但丁', '1687443015588', 32);
INSERT INTO `tb_user` (`id`, `username`, `password`, `name`, `code`, `love_id`) VALUES (32, '小红', '666666', '小红', '1687443070438', 31);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
